package model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@DiscriminatorValue("C")
public class Client extends Person {
	private String cpf;
	private int active = 1;
	@Temporal(TemporalType.DATE)
	private Date dateBirth;
	@OneToMany(cascade={CascadeType.ALL})
	private List<Phone> phones = new ArrayList<Phone>();
	@OneToMany
	private List<Sale> sales;
	@ManyToMany(cascade={CascadeType.ALL})
	private List<Address> addresses = new ArrayList<Address>();

	public Client() {}
	
	
	public Date getDateBirth() {
		return dateBirth;
	}

	public void setDateBirth(Date dateBirth) {
		this.dateBirth = dateBirth;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}
	public String getCpf() {
		return cpf;
	}
	public int getActive() {
		return active;
	}
	public void setActive(int active) {
		this.active = active;
	}
	public List<Phone> getPhones() {
		phones.add(new Phone());
		return phones;
	}
	public void setPhones(List<Phone> phones) {
		this.phones = phones;
	}
	public List<Sale> getSales() {
		return sales;
	}
	public void setSales(List<Sale> sales) {
		this.sales = sales;
	}
	public List<Address> getAddresses() {
		addresses.add(new Address());
		return addresses;
	}
	public void setAddresses(List<Address> addresses) {
		this.addresses = addresses;
	}
}
